import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './pages/Vote';
import reportWebVitals from './reportWebVitals';
import { createStore } from 'redux'

const initial = {
  title: 'React vs Vue 哪家强？',
  suppNum: 0,
  oppNum: 0
}
function reducer(state = initial, action) {
  switch (action.type) {
    case 'SUPPORT':
      state.suppNum += action.payload;
      break;
    case 'OPPOSE':
      state.oppNum += action.payload;
      break;
      default:
        break;
  }
  return state
}

const store = createStore(reducer)

ReactDOM.render(
  <React.StrictMode>
    <App store={store} />
  </React.StrictMode>,
  document.getElementById('root')
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
